<?php
function getHTML($url, $GBKtoUTF8 = true) {
//    if($GBKtoUTF8) return iconv("GBK", "UTF-8", file_get_contents("compress.zlib://" . $url));
//    else return file_get_contents("compress.zlib://" . $url);
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch,CURLOPT_ENCODING , "gzip");
    $content = curl_exec($ch);
    curl_close($ch);
    if ($GBKtoUTF8) return iconv("GBK", "UTF-8", $content);
    else {
        return $content;
    }
}
function dumpVariableToFile($variable, $file, $variableName) {
    $fp = fopen($file, "w");
    fwrite($fp, '<?php' . "\n" . '$' . $variableName . " = " . var_export($variable, true) . ";");
    fclose($fp);
}